{template 'common/header'}
<style>

.audit{cursor:pointer;}

</style>
<script src="{MODULE_URL}/template/static/js/mzp-packed-me.js"></script>
<div class="main">
 <ul class="nav nav-tabs">
	<li{if $_GPC['ty'] == '' && $_GPC['do'] == 'votelist' && $_GPC['ranking'] == ''  } class="active"{/if}><a href="{php echo $this->createWebUrl('votelist',array('rid'=>$_GPC['rid']));}">全部投票</a></li>
    <li{if $_GPC['ty'] == '0'} class="active"{/if}><a href="{php echo $this->createWebUrl('votelist',array('rid'=>$_GPC['rid'],'ty'=>0));}">待审核</a></li>
	<li{if $_GPC['ty'] == '1'} class="active"{/if}><a href="{php echo $this->createWebUrl('votelist',array('rid'=>$_GPC['rid'],'ty'=>1));}">已审核</a></li>
	<li{if $_GPC['ranking'] == '0'} class="active"{/if}><a href="{php echo $this->createWebUrl('votelist',array('rid'=>$_GPC['rid'],'ranking'=>0));}">票数排行</a></li>
	<li{if $_GPC['ranking'] == '1'} class="active"{/if}><a href="{php echo $this->createWebUrl('votelist',array('rid'=>$_GPC['rid'],'ranking'=>1));}">钻石排行</a></li>
	<li{if $_GPC['ranking'] == '1'} class="active"{/if}><a href="{php echo $this->createWebUrl('votedata',array('rid'=>$_GPC['rid'],'ty'=>order));}">全部订单</a></li>
	<li{if $_GPC['do'] == 'votedata'} class="active"{/if}><a href="{php echo $this->createWebUrl('edit',array('id'=>$_GPC['id'],'rid'=>$_GPC['rid']));}">{if $_GPC['id'] > 0}编辑投票用户{else}添加投票用户{/if}</a></li>
</ul>

    
 
    <div class="panel panel-info">
	<div class="panel-heading">筛选</div>
	<div class="panel-body">
		<form action="./index.php" method="get" class="form-horizontal" role="form">
			<input type="hidden" name="c" value="site" />
			<input type="hidden" name="a" value="entry" />
        	<input type="hidden" name="m" value="tyzm_diamondvote" />
        	<input type="hidden" name="do" value="votelist" />
			<input type="hidden" name="rid" value="{$_GPC['rid']}" />
			<div class="form-group">
				<label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">关键字</label>
				<div class="col-sm-8 col-lg-9">
					<input class="form-control" name="keyword" id="" placeholder="输入姓名，手机号或ID" type="text" value="{$_GPC['keyword']}">
				</div>
                                <div class=" col-xs-12 col-sm-2 col-lg-2">
					<button class="btn btn-default"><i class="fa fa-search"></i> 搜索</button>
				</div>
			</div>
 			<div class="form-group">
			</div>
		</form>
		<a class="btn btn-success"href="{php echo $this->createWebUrl('edit',array('rid'=>$_GPC['rid']));}">添加投票用户</a>
	</div>
 
    </div>
    <div style="padding:15px;">
        <table class="table table-hover">
            <thead class="navbar-inner">
                <tr><th  width="50">ID</th>	
					<th  width="60">用户</th>	
                    <th  width="120">用户信息</th>										
                    <th  width="270">图片</th>										
					<th  width="120">数据</th>
					<th>参加时间</th>
                    <th width="80">状态</th>
                    <th style="width:215px;">操作</th>
                </tr>
            </thead>
            <tbody>
                {loop $list $row}
                <tr>

                    <td>{$row['id']}</td>
					<td style="text-align:center"><img src="{php  echo tomedia($row['avatar']);}" width="48"><br />{$row['nickname']}</td>
					<td title="{$row['introduction']}">{$row['name']}（{if $row['sex']==2 }女{elseif $row['sex']==1}男{/if}）
					
					
					<br/>{$row['mobile']}
					<br/>{$row['introduction']}
					</td>										
                    <td >
					<a  href="{php  echo tomedia($row['img1']);}" class=" MagicThumb">
					<img src="{php  echo tomedia($row['img1']);}" width="48"></a>
					<a  href="{php  echo tomedia($row['img2']);}" class=" MagicThumb"><img src="{php  echo tomedia($row['img2']);}" width="48"></a>
					{if $row['img3']!=""}<a  href="{php  echo tomedia($row['img3']);}" class=" MagicThumb"><img src="{php  echo tomedia($row['img3']);}" width="48"></a>{/if}
					{if $row['img4']!=""}<a  href="{php  echo tomedia($row['img4']);}" class=" MagicThumb"><img src="{php  echo tomedia($row['img4']);}" width="48"></a>{/if}
					{if $row['img5']!=""}<a  href="{php  echo tomedia($row['img5']);}" class=" MagicThumb"><img src="{php  echo tomedia($row['img5']);}" width="48"></a>{/if}
					
					</td>
	                <td>票数：{$row['votenum']}<br/>钻石：{$row['diamondnum']}<br/>浏览量：{$row['pvtotal']}<br/>分享量：{$row['sharetotal']}</td>
					<td>{php echo date('Y-m-d H:i:s',$row['createtime'])}</td>
                    <td>{if $row['status']==0}<span class="label label-info audit" data-id="{$row['id']}" data-s="1">待审核</span> {elseif $row['status']==1}<span class="label label-success audit" data-id="{$row['id']}" data-s="0">已审核</span>{/if}
					</td>
                    <td >
					<a class="btn   btn-default" title="投票数据" href="{php echo $this->createWebUrl('votedata',array('rid'=>$row['rid'],'id'=>$row['id'],'ty'=>'votenum'))}" ><i class="fa fa-star-o"></i> 票</a>
					<a class="btn   btn-default" title="钻石数据" href="{php echo $this->createWebUrl('votedata',array('rid'=>$row['rid'],'id'=>$row['id'],'ty'=>'diamondnum'))}" ><i class="fa fa-codepen"></i> 钻</a>
					<a class="btn   btn-default" title="编辑" href="{php echo $this->createWebUrl('edit',array('rid'=>$row['rid'],'id'=>$row['id']))}" ><i class="fa fa-edit"></i></a>
					
					<a class="btn  btn-danger" rel="tooltip" href="#" onclick="drop_confirm('您确定要删除吗?删除不可恢复，同时删除所有相关数据！', '{php echo $this->createWebUrl('otherset',array('ty'=>'deletevoteuser','id'=>$row['id'],'rid'=>$row['rid']))}');" title="删除"><i class="fa fa-times"></i></a>
                    </td>
                </tr>
                {/loop}
            </tbody>
        </table>
        {$pager}
    </div>

</div>
<script>
$(function(){

            $(".check_all").click(function(){
            var checked = $(this).get(0).checked;
                    $("input[type=checkbox]").attr("checked", checked);
            });
                    $("input[name=deleteall]").click(function(){

            var check = $("input:checked");
                    if (check.length < 1){
            err('请选择要删除的记录!');
                    return false;
            }
            if (confirm("确认要删除选择的记录?")){
            var id = new Array();
                    check.each(function(i){
                    id[i] = $(this).val();
                    });
                    $.post('{php echo create_url('site/module', array('do' => 'deleteAll', 'name' => 'tyzm_pintu'))}', {idArr:id}, function(data){
                    if (data.errno == 0)
                    {
                    location.reload();
                    } else {
                    alert(data.error);
                    }


                    }, 'json');
            }

            });
			
			

$(".audit").click(function(){
    var clickthis=$(this);
    var did=clickthis.attr('data-id');
	var audit=clickthis.attr('data-s');
	$.ajax({
		type : "post",
		url : "{php echo $this->createWebUrl('otherset',array('rid'=>$_GPC['rid'],'ty'=>'audit'))}",
		data : {
			id : did,
			audit : audit,
		},
		dataType : "json",
		success : function(res) {
			if (res.status == 200) {
			    clickthis.attr('data-s',(1-audit));
				if(clickthis.hasClass('label-success')){
				    clickthis.removeClass("label-success");
                    clickthis.addClass('label-info');
					clickthis.html('待审核');
                }else{
				    clickthis.removeClass("label-info");
				    clickthis.addClass('label-success');
					clickthis.html('已审核');
				}
			}
		}

	});
});		
			
});




</script>
<script>
            function drop_confirm(msg, url){
            if (confirm(msg)){
            window.location = url;
            }
            }

</script>

{template 'common/footer'}